﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:stz="clr-namespace:Stanza.Silverlight.Controls;assembly=Stanza.Silverlight.Controls">
  <Style TargetType="stz:ModalPopup">
    <Setter Property="Width" Value="300" />
    <Setter Property="Height" Value="200" />
    <Setter Property="Left" Value="0" />
    <Setter Property="Top" Value="0" />
    <Setter Property="BackgroundFill" Value="Gray" />
    <Setter Property="BackgroundOpacity" Value="0.5" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="stz:ModalPopup">
          <Popup x:Name="popupPanel">
            <Canvas x:Name="popupPanelRootCanvas">
              <Canvas x:Name="popupPanelBackgroundCanvas">
                <Rectangle x:Name="popupPanelBackgroundRect" Fill="{TemplateBinding BackgroundFill}" Opacity="{TemplateBinding BackgroundOpacity}"/>
              </Canvas>
              <Canvas x:Name="popupPanelMainCanvas" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                <ContentPresenter Content="{TemplateBinding Content}"/>
              </Canvas>
            </Canvas>
          </Popup>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="stz:PopupColorPicker">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="stz:PopupColorPicker">
          <Canvas Width="250" Height="26" x:Name="rootCanvas">
            <StackPanel Orientation="Horizontal" Height="26" Width="250">
              <Button Width="80" x:Name="chooseColorButton" Cursor="Hand">
                <Rectangle Fill="#FFFFFFFF" Stroke="#FF000000" Width="80" Height="26" x:Name="colorDisplayRect"/>
              </Button>
              <TextBlock Text="  "/>
              <TextBox Width="90" Text="#00000000" VerticalAlignment="Center" x:Name="colorEditBox"/>
            </StackPanel>
            <stz:ModalPopup x:Name="colorPopupPanel" Height="240" Width="270" BackgroundOpacity="0.40" BackgroundFill="Gray">
              <Border Height="240" Width="270" BorderBrush="#FF000000" CornerRadius="4,4,4,4" BorderThickness="2,2,2,2" Padding="4,4,4,4">
                <Border.Background>
                  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFFBF8F8"/>
                    <GradientStop Color="#FFB7AEAE" Offset="0.987"/>
                  </LinearGradientBrush>
                </Border.Background>
                <Grid>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="40"/>
                    <RowDefinition/>
                  </Grid.RowDefinitions>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="30"/>
                  </Grid.ColumnDefinitions>
                  <StackPanel Margin="2,2,2,2" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                    <TextBlock Text="Original:" VerticalAlignment="Center"/>
                    <Rectangle Stroke="#FF000000" Height="20" Width="40" Margin="4,0,10,0" x:Name="originalColorRect"/>
                    <TextBlock Text="Selected:" VerticalAlignment="Center"/>
                    <Rectangle Stroke="#FF000000" Height="20" Width="40" Margin="4,0,10,0" x:Name="selectedColorRect"/>
                    <Button Width="20" Content="+" x:Name="chooseColorPanelButton" Height="20" Cursor="Hand" />
                    <Button Width="20" Content="X" x:Name="closeColorPanelButton" Height="20" Cursor="Hand" Margin="2,0,0,0" />
                  </StackPanel>
                  <Border Margin="4,4,4,4" BorderBrush="#FF000000" BorderThickness="1,1,1,1" Padding="0,0,0,0" Grid.Row="1">
                    <Grid>
                      <Rectangle>
                        <Rectangle.Fill>
                          <LinearGradientBrush StartPoint ="0,0" EndPoint="0,1">
                            <GradientStop Offset="0.00" Color="#ffff0000"/>
                            <GradientStop Offset="0.17" Color="#ffffff00"/>
                            <GradientStop Offset="0.33" Color="#ff00ff00"/>
                            <GradientStop Offset="0.50" Color="#ff00ffff"/>
                            <GradientStop Offset="0.66" Color="#ff0000ff"/>
                            <GradientStop Offset="0.83" Color="#ffff00ff"/>
                            <GradientStop Offset="1.00" Color="#ffff0000"/>
                          </LinearGradientBrush>
                        </Rectangle.Fill>
                      </Rectangle>
                      <Canvas>
                        <Canvas x:Name="huePointer" Width="20" Height="10">
                          <Rectangle Width="20" Height="10" StrokeThickness="3" Stroke="#FFFFFFFF" RadiusX="2" RadiusY="2"/>
                          <Rectangle Width="20" Height="10" StrokeThickness="1" Stroke="#FF000000" RadiusX="2" RadiusY="2"/>
                        </Canvas>
                      </Canvas>
                      <Rectangle x:Name="hueMonitor" Fill="Transparent" Cursor="Hand"/>
                    </Grid>
                  </Border>
                  <Border Margin="4,4,4,4" BorderBrush="#FF000000" BorderThickness="1,1,1,1" Grid.Column="1" Grid.Row="1">
                    <Grid>
                      <Rectangle x:Name="colorRect" Fill="Red"/>
                      <Rectangle x:Name="rectWhiteGradient">
                        <Rectangle.Fill>
                          <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                            <GradientStop Offset="0" Color="#ffffffff"/>
                            <GradientStop Offset="1" Color="#00ffffff"/>
                          </LinearGradientBrush>
                        </Rectangle.Fill>
                      </Rectangle>
                      <Rectangle x:Name="rectBlackGradient">
                        <Rectangle.Fill>
                          <LinearGradientBrush StartPoint="0,1" EndPoint="0, 0">
                            <GradientStop Offset="0" Color="#ff000000"/>
                            <GradientStop Offset="1" Color="#00000000"/>
                          </LinearGradientBrush>
                        </Rectangle.Fill>
                      </Rectangle>
                      <Canvas>
                        <Canvas x:Name="selectionPointer" Width="10" Height="10">
                          <Ellipse Width="10" Height="10" StrokeThickness="3" Stroke="#FFFFFFFF"/>
                          <Ellipse Width="10" Height="10" StrokeThickness="1" Stroke="#FF000000"/>
                        </Canvas>
                      </Canvas>
                      <Rectangle x:Name="colorMonitor" Fill="Transparent" Cursor="Hand"/>
                    </Grid>
                  </Border>
                  <Border Margin="4,4,4,4" BorderBrush="#FF000000" BorderThickness="1,1,1,1" Grid.Column="2" Grid.Row="1">
                    <Grid>
                      <Rectangle>
                        <Rectangle.Fill>
                          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF000000"/>
                            <GradientStop Color="#FFFFFFFF" Offset="1"/>
                          </LinearGradientBrush>
                        </Rectangle.Fill>
                      </Rectangle>
                      <Canvas>
                        <Canvas x:Name="opacityPointer" Width="20" Height="10">
                          <Rectangle Width="20" Height="10" StrokeThickness="3" Stroke="#FFFFFFFF" RadiusX="2" RadiusY="2"/>
                          <Rectangle Width="20" Height="10" StrokeThickness="1" Stroke="#FF000000" RadiusX="2" RadiusY="2"/>
                        </Canvas>
                      </Canvas>
                      <Rectangle x:Name="opacityMonitor" Fill="Transparent" Cursor="Hand"/>
                    </Grid>
                  </Border>
                </Grid>
              </Border>
            </stz:ModalPopup>
          </Canvas>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>